/*
** my_str_isalpha.c for my_str_isalpha in /home/nadali_t//local/piscine/Jour_06/ex_10
** 
** Made by thomas nadalie
** Login   <nadali_t@epitech.net>
** 
** Started on  Mon Oct  8 16:16:28 2012 thomas nadalie
** Last update Mon Nov 19 17:39:40 2012 thomas nadalie
*/

#include	"my.h"

int		my_str_isalpha(char *str)
{
  int		i;
  int		charac;
  int		other;

  i = 0;
  charac = 0;
  other = 0;
  while (str[i])
    {
      if ((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z'))
	{
	  charac = charac + 1;
	  if (charac == my_strlen(str))
	    return (1);
	}
      else if ((str[i] >= ' ' && str[i] <= 'A') || (str[i] >= 'Z' && str[i] <= 'a')
	       || str[i] >= 'z')
	{
	  other = other + 1;
	  if (other != 0)
	    return (0);
	}
      i = i + 1;
    }
  return (2);
}
